package com.briup.day07;

/**
 * @author ThinkBook
 */
public class Test03_Overload {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        int c = 25;
        float m = 3.1F;
        float n = 2.4f;

        double r = getAvg(a,b,c);
        System.out.println("r: " + r);

        r = getAvg(m,n);
        System.out.println("r: " + r);

        r = getAvg(b,c);
        System.out.println("r: " + r);
    }
        //重载条件
        //  1.同一个类中
        //  2.方法名一致
        //  3.形参列表不同【个数不同、类型不同】
        public static double getAvg(int m, int n) {
            double sum = m + n;
            return sum / 2;
        }

        public static double getAvg(int x, int y, int z) {
            double sum = x + y + z;
            return sum / 3;
        }

        public static float getAvg(float x, float y) {
            return (x+y)/2;
        }

}
